<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xml:lang="en-gb" xmlns="http://www.w3.org/1999/xhtml"
	lang="en-gb">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="index, follow">
<meta name="keywords" content="joomla, Joomla">
<meta name="description"
	content="Joomla! - the dynamic portal engine and content management system">
<meta name="generator"
	content="Joomla! 1.5 - Open Source Content Management">
<title>Welcome to the Mountain View Community Hospital</title>
<link rel="stylesheet" href="../image/template.css" type="text/css">
<link rel="stylesheet" href="../image/constant.css" type="text/css">

<!--equal-->
<!--[if IE]>
   <script type="text/javascript" src="/joomla_24417/templates/theme288/scripts/ie_png.js"></script>
   <script type="text/javascript">
       ie_png.fix('.png');
	</script>
<![endif]-->
</head>
<sql:setDataSource var="datas" driver="oracle.jdbc.driver.OracleDriver"
     url="jdbc:oracle:thin:@localhost:1521:orcl"
     user="dbfp_dba"  password="dbfpdba"/>

<sql:query dataSource="${datas}" var="patient" sql="SELECT patient_id FROM PATIENT_T where admission_type='R'"/>

<script>
 function ChanGeValue(){
 var sel=document.treatmentform.patientlist;
 var txt = sel.options[sel.selectedIndex].text;
 var url="/project/resources/carecenter/viewResidentReport.jsp?patientid=";
 if(txt!="--select one--")
 url=url+txt;
 window.location.href=url;
 }
</script>
<c:if test="${param.patientid!=null }">
<sql:query dataSource="${datas}" var="treatment" sql="SELECT * FROM treatment_t where patient_id='${param.patientid}'"/>
</c:if>

<body id="body">

	<!--header-->
	<div class="tail-logo">
		<div class="tail-right"></div>
		<div class="main">
			<div class="row-logo">
				<h1 style="font-size: 30px; color: white;">Mountain View
					Community Hospital</h1>
			</div>
		</div>
	</div>
	<div class="tail-header">
		<div class="main">
			<div class="header">
				<div class="fright">
					<div class="row-1">
						<div class="moduletable">
							<img src="../image/header_link_img_1.gif" alt=""> <img
								src="../image/header_link_img_2.gif" alt=""> <img
								src="../image/header_link_img_3.gif" alt=""> <img
								src="../image/header_link_img_4.gif" alt=""> <img
								src="../image/header_link_img_5.gif" alt="">
						</div>
					</div>

				</div>

				<div class="clear1"></div>
			</div>
		</div>
	</div>
	<div class="tail-row-top-menu clear">
		<div class="main">
			<div class="row-top-menu clear">
				<div class="fright">
					<div class="module" style="text-align: right; margin-top: 15px;">
						<h4>${accountID},${role},${personID}<a href="/project/resources/common/login.htm">Logout</a></h4>


					</div>

				</div>
				<div class="fleft">
					<div class="module-search"></div>
				</div>
			</div>
		</div>
	</div>
	<div class="tail-content clear">
		<div class="main">
			<!--content-->
			<div id="content">
				<div class="clear">
					<!--left-->
					<div id="left">
						<div class="left-indent">
							<div class="clear">
								<div class="wrapper-menu module_menu" style="padding: 0;">
									<div class="wrapper-menu-width">
										<div class="border-top">
											<div class="border-left">
												<div class="border-right">
													<div class="corner-top-left">
														<div class="corner-top-right">
															<table style="width: 100%;" class="width">
																<tbody>
																	<tr>
																		<td class="width extra-height">
																			<div class="clear">
																				<div class="box-title">
																					<h3
																						style="padding: 27px 0 0 32px; color: #FFF; font-size: 14px; font-family: Georgia,"TimesNewRoman", Times, serif">Main
																						menu:</h3>
																				</div>
																				<div class="wrapper-menu-box">
																					<div class="clear">
																						<ul class="menu" style="padding: 0 32px 22px 31px">
																							<li class="item2"><a
																								href="/project/resources/carecenter/addResident.jsp"><span>Add</span></a></li>
																							<li class="item1"><a
																								href="/project/resources/carecenter/viewResident.jsp"><span>View</span></a></li>
																							<li id="current" class="active item1"><a
																								href="/project/resources/carecenter/viewResidentReport.jsp"><span>Report</span></a></li>
																						    <li class="item2"><a
																								href="/project/resources/carecenter/deleteResident.jsp"><span>Leave/Change Bed</span></a></li>
																							
																						</ul>
																					</div>
																				</div>
																			</div>
																		</td>
																	</tr>
																</tbody>
															</table>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>



							</div>
						</div>
					</div>
					<!--center-->
					<div id="container">
						<div class="container-indent">
						<form name="treatmentform">
							<div class="row-box clear">
								<div class="clear wrapper-box-extra module s2"
									style="width: 548px">
									<div class="box-title">
										<div class="bull-title png">
											<h3>View Resident</h3>
										</div>
									</div>
									<div>
										<div class="box-indent">
											<div style="height: 250px;" class="clear equal">

												<div>
													<p style="color: #002C4B; font-size: 14px;">
														Select Patient: <select name="patientlist" id="11" onchange="ChanGeValue()">
														    <option>--select one--</option>
															<c:forEach var="pid" items="${patient.rows}">
															
															<option ${pid.patient_id==param.patientid?'selected':' '}>${pid.patient_id }</option>
															</c:forEach>

														</select>
													</p>
													<p>&nbsp;</p>
												</div>
												
												<table name="table1"border="1">
													<tr>
														<th>TreatmentID</th>
                                                        <th>PhysicianID</th>
														<th>Date</th>
                                                    </tr>
                                                   
                                                    <c:if test="${param.patientid!=null }">
                                                    <c:forEach var="treat" items="${treatment.rows}">
														<tr>
														<td>${treat.treatment_id}</td>
														<td>${treat.physician_id}</td>
														<td>${treat.assigned_date}</td>
														</tr>
													</c:forEach>
                                                    </c:if>
													
												</table>
												
											

											</div>
										</div>
									</div>
								</div>

							</div>
							<input type="hidden" name="patientid"/>
							</form>
							<div class="clear">

								<table class="blog" cellpadding="0" cellspacing="0">
									<tbody>
										<tr>
											<td valign="top">
												<div>


													<div class="article-indent">
														<div class="clear">
															
														</div>
													</div>
													<div class="article-separator-indent">
														<span class="article_separator">&nbsp;</span>
													</div>

												</div>

											</td>
										</tr>



									</tbody>
								</table>

							</div>
						</div>
					</div>
				</div>
			</div>

		</div>
	</div>
</body>
</html>